import request from "../untils/request";

//http://39.98.123.211  get  无参
//获取分类列标配
export const reqCategoryList = () =>
  request.get("/api/product/getBaseCategoryList");
//获取搜索数据
export function getSearchList(params) {
  return request.post(`/api/list`, { params });
}

//获取产品详情
export function getGoodsInfo(skuId) {
  return request.get(`/api/item/${skuId}`);
}
//产品添加到购物车，或者更新
export function addOrUpdateCatr(skuId, skuNum) {
  return request.post(`/api/cart/addToCart/${skuId}/${skuNum}`);
}
//过去购物车里的数据
export function getShopCartList() {
  return request.get(`/api/cart/cartList`);
}
//删除购物车数据
export function removeCartList(skuId) {
  return request.delete(`/api/cart/deleteCart/${skuId}`);
}
//改变商品的选中的状态
export function chengeCheck(skuId, isChecked) {
  return request.get(`/api/cart/checkCart/${skuId}/${isChecked}`);
}
//获取验证码 /api/user/passport/sendCode/phone
export function getCode(phone) {
  return request.get(`/api/user/passport/sendCode/${phone}`);
}
//注册
export function register(data) {
  return request.post(`/api/user/passport/register`, data);
}
//登录
export function login(data) {
  return request.post(`/api/user/passport/login`, data);
}
//获取用户的信息 戴着token
export function getUserInfo() {
  return request.get(`/api/user/passport/auth/getUserInfo`);
}
//退出登录
export function outLogin() {
  return request.get(`/api/user/passport/logout`);
}
//获取地址信心
export function getSite() {
  return request.get(`/api/user/userAddress/auth/findUserAddressList`);
}
//获取氢弹
export function getGoodsOrder() {
  return request.get(`/api/order/auth/trade`);
}
//提交订单
export function postOrder(tradeNo, data) {
  return request.post(`/api/order/auth/submitOrder?tradeNo=${tradeNo}`, data);
}
//获取订单支付信息
export function getOrderPayInfo(orderId) {
  return request.get(`/api/payment/weixin/createNative/${orderId}`);
}
//获取订单支付状态
export function getPayStutas(orderId) {
  return request.get(`/api/payment/weixin/queryPayStatus/${orderId}`);
}
//获取个人中心的数据
export function getUserList(page, limit) {
  return request.get(`/api/order/auth/${page}/${limit}`);
}
